﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication3
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private String weton()
        {
            string[] words = userControl11.kalender.getHari().Split(' ');
            string sifat = "";
            switch (words[1])
            {
                case "LEGI": sifat += "Suka manis manis saja"; break;
                case "PAHING": sifat += "Alergi terhadap orang bersin bersin"; break;
                case "PON": sifat += "Suka berkompetisi"; break;
                case "WAGE": sifat += "Suka menerima masukan orang lain dan membawa beban mereka juga"; break;
                case "KLIWON": sifat += "Misterius dan mengerikan"; break;
                default: sifat = "error"; break;
            }
            return sifat;
        }

        private String zodiac()
        {
            string sifat = "";
            userControl11.kalender.setToMasehi();
            int th = Int32.Parse(userControl11.kalender.getTahun());
            th -= 4;
            switch (th % 12)
            {
                case 0: sifat += "Tikus"; break;
                case 1: sifat += "Kerbau"; break;
                case 2: sifat += "Macan"; break;
                case 3: sifat += "Kelinci"; break;
                case 4: sifat += "Naga"; break;
                case 5: sifat += "Ular"; break;
                case 6: sifat += "Kuda"; break;
                case 7: sifat += "Kambing"; break;
                case 8: sifat += "Monyet"; break;
                case 9: sifat += "Ayam"; break;
                case 10: sifat += "Anjing"; break;
                case 11: sifat += "Babi"; break;
                default: sifat += "error"; break;
            }
            return sifat;
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            int tgl;
            string tamp = textBox2.Text;
            tgl = int.Parse(tamp);
            int bln = comboBox1.SelectedIndex + 1;
            int th = int.Parse(textBox3.Text);
            string nama = textBox1.Text;
            userControl11.kalender.goTo(th, bln, tgl);
            userControl11.kalender.setToJawa();
            MessageBox.Show(nama + " terlahir pada \n" + userControl11.kalender.getHari() + "\n" + 
                userControl11.kalender.showJawa(th, bln, tgl) +
                "\n" + nama + " merupakan seseorang yang " + "\n" + weton());
        }

        private void textBox3_TextChanged(object sender, EventArgs e)
        {

        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            int tgl;
            string tamp = textBox2.Text;
            tgl = int.Parse(tamp);
            int bln = comboBox1.SelectedIndex + 1;
            int th = int.Parse(textBox3.Text);
            string nama = textBox1.Text;
            userControl11.kalender.goTo(th, bln, tgl);
            userControl11.kalender.setToChinese();
            MessageBox.Show(nama + " terlahir pada \n" + userControl11.kalender.getHari() + "\n" + 
                userControl11.kalender.showChinese(th, bln, tgl) +
                "\n" + nama + " memiliki zodiac " + "\n" + zodiac());
        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        
        private void btnMasehi_Click(object sender, EventArgs e)
        {
            userControl11.jnsCalendar = KalenderTradisional.UserControl1.jns.Masehi;
        }

        private void btnJawa_Click(object sender, EventArgs e)
        {
            userControl11.jnsCalendar = KalenderTradisional.UserControl1.jns.Jawa;
        }

        private void btnChina_Click(object sender, EventArgs e)
        {
            userControl11.jnsCalendar = KalenderTradisional.UserControl1.jns.China;
        }
    }
}
